<!DOCTYPE html>
<html>
    <head>
        <!-- 加载样式及META信息 -->
        {include file="common/meta" /}
        <style>
        body.fixed{position:relative !important}
        @media (min-width: 767px){
            /* 重定义大屏时侧栏宽度 */
            .main-header .logo, .main-sidebar, .left-side{
                width: 200px;
            }
            .main-header .navbar, .content-wrapper, .right-side, .main-footer{
                margin-left: 200px;
            }
        }
        /* 优化无标签时顶栏菜单外漏 PGcao add 2024-07-26 */
        body .main-header .nav-addtabs{overflow:hidden;}
        body.multipletab .main-header .nav-addtabs{overflow:unset;}
        body .main-header .nav-addtabs > li .close-tab{background: none;}
        body .main-header .nav-addtabs > li .close-tab:hover{color: red !important;background: none;}
        /* 左侧菜单栏无可操作菜单时隐藏左侧菜单栏 PGcao add 2024-07-19 */
        @media (min-width: 768px) {            
            body.hide-menu aside.main-sidebar{display:none !important;}
            body.hide-menu nav #secondnav{width:calc(100% + 200px);margin-left:-200px !important;}
            body.hide-menu.sidebar-collapse nav #secondnav{width:calc(100% + 50px);margin-left:-50px !important;}
            body.hide-menu>.wrapper>.content-wrapper{margin-left: 0 !important;}
        }
        </style>
    </head>
    <body class="hold-transition hide-menu {$Think.config.fastadmin.adminskin|default='skin-black-blue'} sidebar-mini {:$Think.cookie.sidebar_collapse?'sidebar-collapse':''} fixed {:$Think.config.fastadmin.multipletab?'multipletab':''} {:$Think.config.fastadmin.multiplenav?'multiplenav':''}" id="tabs" un-cloak>
        <div class="wrapper">
            <!-- 头部区域 -->
            <header id="header" class="main-header">
                {if preg_match('/\/admin\/|\/admin\.php|\/admin_d75KABNWt\.php/i', url())}
                <style>.main-sidebar, .content-wrapper{margin-top: 52px;}</style>
                <div class="alert alert-danger-light text-center" style="margin-bottom:0;border:none;">
                    {:__('Security tips')}
                </div>
                {/if}

                {include file='common/header' /}
            </header>

            <!-- 左侧菜单栏 -->
            <aside class="main-sidebar">
                {include file='common/menu' /}
            </aside>

            <!-- 主体内容区域 -->
            <div class="content-wrapper tab-content tab-addtabs">
                {if $fixedmenu}
                <div role="tabpanel" class="tab-pane {:$referermenu?'':'active'}" id="con_{$fixedmenu.id}">
                    <iframe src="{$fixedmenu.url}?addtabs=1" width="100%" height="100%" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling-x="no" scrolling-y="auto" allowtransparency="yes"></iframe>
                </div>
                {/if}
                {if $referermenu && false}
                <div role="tabpanel" class="active" id="con_{$referermenu.id}"></div>
                {/if}
            </div>

            <!-- 底部链接,默认隐藏 -->
            <footer class="main-footer hide">
                <div class="pull-right hidden-xs"></div>
                <strong>Copyright &copy; 2016-{:date("Y")} <a href="__PUBLIC__">{$site.name}</a>.</strong> All rights reserved.
            </footer>

            <!-- 右侧控制栏 -->
            <div class="control-sidebar-bg"></div>
            {include file="common/control" /}
        </div>

        <!-- 加载JS脚本 -->
        {include file="common/script" /}
    </body>
{if $Think.config.app_debug && $Think.config.app_trace}
<script>
    // <![CDATA[  <-- For Live Server In Dev By PGcao
    if ('WebSocket' in window && location.port && location.port != '80') {
        (function () {
            function refreshCSS() {
                var sheets = [].slice.call(document.getElementsByTagName("link"));
                var head = document.getElementsByTagName("head")[0];
                for (var i = 0; i < sheets.length; ++i) {
                    var elem = sheets[i];
                    var parent = elem.parentElement || head;
                    parent.removeChild(elem);
                    var rel = elem.rel;
                    if (elem.href && typeof rel != "string" || rel.length == 0 || rel.toLowerCase() == "stylesheet") {
                        var url = elem.href.replace(/(&|\?)_cacheOverride=\d+/, '');
                        elem.href = url + (url.indexOf('?') >= 0 ? '&' : '?') + '_cacheOverride=' + (new Date().valueOf());
                    }
                    parent.appendChild(elem);
                }
            }
            try {
                var address = 'ws://' + location.hostname + ':5500/ws';
                var socket = new window.WebSocket(address);
                socket.onmessage = function (msg) {
                    console.log('DEBUG DEV Socket', msg);
                    setTimeout(function () {
                        if (msg.data == 'reload') window.location.reload(true);
                        else if (msg.data == 'refreshcss') refreshCSS();
                    }, 500);
                };
                if (sessionStorage && !sessionStorage.getItem('IsThisFirstTime_Log_From_LiveServer')) {
                    console.log('Live reload enabled.');
                    sessionStorage.setItem('IsThisFirstTime_Log_From_LiveServer', true);
                }
            } catch (e) {
                console.log("DEBUG DEV Socket Error:", e);
            }
        })();
    }
	// ]]>
</script>
{/if}
</html>
